const xrFrameSystem1 = wx.getXrFrameSystem();
xrFrameSystem1.registerEffect('bgTransparent', scene => scene.createEffect({
  "name": "bgTransparent",
      "properties": [
        {
          "key": "u_baseColorFactor",
          "type": 3,
          "default": [1, 1, 1, 0]
        }
      ],
      "images": [{ "key": "u_baseColorMap", "default": "white", "macro": "WX_USE_BASECOLORMAP" }],
      "defaultRenderQueue": 3000,
      "passes": [
        {
          "renderStates": { "cullOn": true, "blendOn": true, "depthWrite": true, "cullFace": 0 },
          "lightMode": "ForwardBase",
          "useMaterialRenderStates": true,
          "shaders": [0, 1]
        }],
      "shaders": [
        `#version 100
  precision highp float;
  attribute vec3 a_position;
  attribute vec2 a_texCoord;


  uniform mat4 u_projection;
  uniform mat4 u_world;
  uniform mat4 u_view;
  varying highp vec2 vTextureCoord;
  
  void main()
  {
    vTextureCoord = a_texCoord;
    gl_Position = u_projection * u_view * u_world * vec4(a_position,1.0);
  }`,
        `#version 100
  precision highp float;


  uniform highp vec4 u_baseColorFactor;
  #ifdef WX_USE_BASECOLORMAP
    uniform sampler2D u_baseColorMap;
  #endif


  varying highp vec2 vTextureCoord;


  void main()
  {
#ifdef WX_USE_BASECOLORMAP
  vec4 color = texture2D(u_baseColorMap, vec2(vTextureCoord.x,vTextureCoord.y));
  vec4 colora = texture2D(u_baseColorMap, vec2(vTextureCoord.x,vTextureCoord.y));
  // 定义一个颜色阈值，用于判断是否接近黑色，这里的阈值可以根据实际情况调整
  const float blackThreshold = 0.1; 
  
  // 计算颜色的亮度值（一种简单的衡量方式，将RGB三个通道的值平均）
  float luminance = (color.r + color.g + color.b) / 3.0;
  
  // 判断颜色是否接近黑色，如果接近则设置透明度为0（完全透明），否则保留原来的透明度（这里用colora.x）
  float alpha = luminance < blackThreshold? 0.0 :0.9;
  
  vec4 baseColor = vec4(color.xyz, alpha);

  //vec4 baseColor = vec4(color.xyz,colora.x);
#else
    vec4 baseColor = u_baseColorFactor;
#endif


  gl_FragData[0] = baseColor;
  }  
    `],
  }));